<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>编辑收款单</title>
	<#include "/common/resource.ftl">
	<script type="text/javascript">
        top.domain = "${params.contextPath}";
		$(function () {
            LocalStorage.registHandler("elder_handler_select", function (data) {
                $('input[name="elderId"]').val(data.id);
                $('input[name="elderName"]').val(data.name);
            });

			<#if (params.id)??>
				$.ajaxRequest({
					url: '${params.contextPath}/web/receipt/query.json',
					data: {id: "${params.id}"},
					success: function (data) {
						if (!data.success) {
							$.message(data.message);
							return;
						}
						var record = data.data;
						for (var key in record) {
							$("[name='" + key + "']").val(record[key]);
						}
                        $("[name='beginDate']").val(record.beginDateStr);
                        $("[name='endDate']").val(record.endDateStr);
					}
				});
			</#if>
		});
	</script>
</head>
<body>
<div class="ui-form" style="padding:20px;">
    <form class="layui-form ajax-form" action="${params.contextPath}/web/receipt/<#if (params.id)??>modify<#else>save</#if>.json" method="post">
        <input type="hidden" name="id" value="${params.id!}" />
        <input type="hidden" name="workflowDefineId" value="${params.defineId!}" />
        <div class="layui-form-item">
            <label class="layui-form-label">老人<span class="ui-request">*</span></label>
            <div class="layui-input-block ui-more-parent">
                <input type="hidden" name="elderId"/>
                <input type="text" name="elderName" placeholder="请选择老人" p="model:'elder',handlerId:'elder_handler_select'" class="layui-input single-model-select {required:true}" readonly/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开始日期<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" name="beginDate" placeholder="请输入开始日期" class="layui-input ui-date {required:true}" readonly/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束日期<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" name="endDate" placeholder="请输入结束日期" class="layui-input ui-date {required:true}" readonly/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">床位费</label>
            <div class="layui-input-block">
                <input type="text" name="bedAmount" placeholder="请输入床位费" class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">护理费</label>
            <div class="layui-input-block">
                <input type="text" name="nurseAmount" placeholder="请输入护理费" class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">生活费</label>
            <div class="layui-input-block">
                <input type="text" name="liveAmount" placeholder="请输入生活费" class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">其他费用</label>
            <div class="layui-input-block">
                <input type="text" name="otherAmount" placeholder="请输入其他费用" class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">总费用<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" name="totalAmount" placeholder="请输入总费用" class="layui-input {required:true}"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">付款方式<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <select name="payType" class="layui-input {required:true}">
                    <option value="">请选择</option>
                    <option value="1">现金</option>
                    <option value="2">刷卡</option>
                    <option value="3">转账</option>
                    <option value="4">其他</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" placeholder="请输入备注" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="submit" value="保存" class="layui-btn" />
            </div>
        </div>
    </form>
</div>
</body>

</html>
